#include "iBe.h"

Object::Object()
{}

Object::~Object()
{
}

LocationControllerPtr Object::getLocationController()
{
  LocationControllerPtr retPtr;

  retPtr.reset(new LocationController(location));
  
  return retPtr;
}

bool Object::update(const UINT64 &_time)
{
  if (controller)
    controller->update(_time);

  return false;
}

void Object::setMeshName( const String &_name )
{
  meshName = _name;
}

const String& Object::getMeshName() const
{
  return meshName;
}

void Object::setMesh( GLMeshPtr _mesh )
{
  mesh = _mesh;
}

void Object::setLocation(float _x, float _y, float _z)
{
  location[0] = _x;
  location[1] = _y;
  location[2] = _z;
}

void Object::setOrientation(float _phi, float _theta)
{
  orientation[0] = _phi;
  orientation[1] = _theta;
}

void Object::setController(ControllerPtr _controller)
{
  controller = _controller;
}

void Object::set(unsigned char _key, float _value)
{
  switch(_key)
    {
    case OBJECT_X:
      location[0] = _value;
      break;

    case OBJECT_Y:
      location[1] = _value;
      break;

    case OBJECT_Z:
      location[2] = _value;
      break;

    case OBJECT_PHI:
      orientation[0] = _value;
      break;

    case OBJECT_THETA:
      orientation[1] = _value;
      break;
    }
}
